﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css" href="../style.css">
<link href="../tablecloth/tablecloth.css" rel="stylesheet" type="text/css" media="screen" />
<script type="text/javascript" src="../tablecloth/tablecloth.js"></script>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body>

<?php	

	include("../inc/joomlaInt_admin.php");
	include("../inc/inc_configuration.php");

if ($jUser==0)
{
	echo "Bitte zuerst einloggen!";
}
else
{	
	
	$q="SELECT gid FROM $tbl_users WHERE id=$jUser";
					$qe=mysql_query($q);
					$qeo=mysql_fetch_object($qe);
					
					$gid=$qeo->gid;
					
					if ($gid!=$admingroup)
					{
						echo "Du bist kein Admin!";
						break;
					}
					
	$hC=$_POST["heimC"];
	$gC=$_POST["gastC"];
	$hG=$_POST["heimT"];
	$gG=$_POST["gastT"];
	$match=$_POST["match"];
	
	if ($hT=="")
	{
		$hT=0;
	}
	
	if ($gT=="")
	{
		$gT=0;
	}
	
	if ($hC=="")
	{
		$hC=0;
	}
	
	if ($gC=="")
	{
		$gC=0;
	}
	
	
	$winner=0;
	if ($hG>$gG)
	{
		$winner=1;
	}
	else
	{
		if ($gG>$hG)
		{
			$winner=2;
		}
		else
		{
			$winner=3;
		}	
	}
	
	$pd=time();
	
	
	$q="	UPDATE $tbl_matches set homeG=$hG, guestG=$gG, winner=$winner, homeC=$hC, guestC=$gC, free=4, comment='gewertet', playDate=$pd, confDate=$pd WHERE id=$match";
	$qe=mysql_query($q);
	
	echo'Sie werden weitergeleitet... <meta http-equiv="refresh" content="0; URL=offene_spiele.php">';
}	
?>

</body>
</html>